<%@ page language="java" contentType="text/html; charset=UTF-8" pageEncoding="UTF-8"%>
<%@ taglib prefix="play" uri="/WEB-INF/couponplay.tld" %>
<%@ taglib prefix="c" uri="http://java.sun.com/jsp/jstl/core" %>
<%@ taglib prefix="fmt" uri="http://java.sun.com/jsp/jstl/fmt" %>
<%@ taglib prefix="fn" uri="http://java.sun.com/jsp/jstl/functions" %> 
<div style="position:relative;">
	<table style="border-spacing:0px;border-collapse:collapse;border-top:7px solid #fff;border-bottom:0;background:#fff;width:100%;" cellpadding="0">
		<tr id="appAdver" onclick="appDownload();" style="display:none">
			<td colspan="2">
				<table style="width:100%;background:#1A1C22">
					<tr style="height:80px;">
						<td style="width:90px;"><img src="/image/couponplay-logo.png"></td>
						<td colspan="3" style="text-align:left"><span style="font-size:14pt;font-weight:bold;">안드로이드앱 다운로드</span></td>
						<td style="width:72px;"><img src="/image/download_01.png"></td>
					</tr>
				</table>
			</td>
		</tr>
		<tr><td colspan="2" style="height:3px;"></td></tr>
		<tr>
			<td colspan="2">
				<table class="orderTab">
					<tr>
						<td onclick="goSearchType('SOCIAL_DEAL', 'HIT');" class="<c:if test="${empty condition || (condition.order eq 'HIT' && conditon.type ne 'FREE_DEAL')}">on</c:if>">인기순</td>
						<td onclick="goSearchType('SOCIAL_DEAL', 'BUY_COUNT');" class="<c:if test="${conditon.type ne 'FREE_DEAL' && condition.order eq 'BUY_COUNT'}">on</c:if>">구매순</td> 
						<td onclick="goSearchType('SOCIAL_DEAL', 'PRICE_ROW');" class="<c:if test="${conditon.type ne 'FREE_DEAL' && condition.order eq 'PRICE_ROW'}">on</c:if>">가격순</td>
						<td onclick="goSearchType('SOCIAL_DEAL', 'RATE');" class="<c:if test="${conditon.type ne 'FREE_DEAL' && condition.order eq 'RATE'}">on</c:if>">할인율순</td>
						<td onclick="goSearchType('FREE_DEAL', '');" class="<c:if test="${condition.type eq 'FREE_DEAL'}">on</c:if>">무료상품</td>
					</tr>
				</table>
			</td>
		</tr>
		<tr><td colspan="2" style="height:3px;"></td></tr>
		<c:forEach items="${searchDealViewList.deals}" var="deal" varStatus="status">
		<c:if test="${status.first}">
		<tr><td colspan="2" style="background:#e4e4e4;height:1px;"></td></tr>
		</c:if>
		<tr onclick="goDeal('${deal.id}', '${deal.providerCode}', '${deal.metaId}');" style="cursor:hand;cursor:pointer;">
			<td style="width:140px;height:94px;padding:0 2px;">
				<div>
					<c:set var="imgUrl">
						<c:choose>
						<c:when test="${deal.providerCode eq 'CP'}">${deal.imageUrl7}</c:when>
						<c:otherwise>${deal.imageUrl}</c:otherwise>
						</c:choose>
					</c:set>
					<img class="corner" src="${imgUrl}" style="width:135px;height:90px;"/>
				</div>
			</td>
			<td>
				<div onclick="" style="background:#fff;line-height:160%;padding:3px 3px 3px 5px;position:relative; top:0px; left:0px; overflow:hidden;">
					<div style="font-weight:bold;color:#1A1C22;">
						<span><play:stringReduce text="${deal.title}" length="18"/></span><br/>
				    </div>
					<div style="line-height:130%;">
						<span style="text-decoration:line-through;font-size:8pt;color:#888888;"><fmt:formatNumber value="${deal.originalPrice}" pattern="#,###"/>원</span>
				    	<span style="color:#1A1C22;font-weight:bold;font-size:12pt;"><fmt:formatNumber value="${deal.salesPrice}" pattern="#,###"/>원</span>
						<span style="color:#FF0000;font-size:14pt;">${deal.discountRate}%</span> <br/>
				    	<span style="font-size:8pt;color:#888888;">구매중</span> <span style="color:#888888;font-weight:bold;font-size:8pt;"><fmt:formatNumber value="${deal.nowCount}" pattern="#,###"/>개</span><br/>
				    	<span style="color:#888888;font-weight:bold;font-size:8pt;"><fmt:formatDate value="${deal.saleEndAt}" pattern="yyyy-MM-dd"/>까지</span>
	    				<span class="corner4" style="color:#888888;font-size:8pt;background:#e4e4e4;padding:2px;"><play:providerLogo providerCode='${deal.providerCode}'/></span>
				    </div>
		    	</div>
			</td>
		</tr>
		<tr><td colspan="2" style="background:#e4e4e4;height:1px;"></td></tr>
		</c:forEach>
		<c:if test="${searchDealViewList.size eq 0}">
		<tr>
			<td height="50px">검색된 생품이 없습니다.</td>
		</tr>
		</c:if>
	</table>
</div>
<%@include file="includePaging.jsp"%>
